<template>
	<view class="container pt_8">
		<view class="bc_fff plr_16">
			<view class="fx aic bob_1 boc_grey ptb_12 fx_1 flow_h">
				<uni-icons custom-prefix="iconfont" type="icon-shangdian" color="#999" size="32rpx"></uni-icons>
				<view class="ml_4 fx_1 flow_h">{{dataInfo.brandName||''}}</view>
			</view>
			<view class="pt_12 pb_18">
				<GoodsCard type="aftersale-card" :data="dataInfo" goodsType="7" :toDetail="false" />
			</view>
		</view>
		<view class="mt_8 ptb_12 plr_16 bc_fff">
			<view class="fx jcb">
				<text>申请时间</text>
				<text class="fc_999">{{dataInfo.applyTime||''}}</text>
			</view>
			<view class="fx jcb mt_8">
				<text>状态</text>
				<text class="fc_primary">{{dataInfo.dealStatus==1?'处理中':'已处理'}}</text>
			</view>
			<view class="fx jcb mt_8">
				<text>售后方式</text>
				<text class="fc_999">{{dataInfo.afterSaleType==1?'售后维护':'退货'}}</text>
			</view>
			<view class="fx jcb mt_8">
				<text>售后原因</text>
				<text class="fc_999">{{reasonDir[dataInfo.afterSaleReason]||''}}</text>
			</view>
			<view class="mt_24">
				<view>
					描述
				</view>
				<view class="mt_12 fc_999">
					{{dataInfo.describes||''}}
				</view>
			</view>
			<view class="mt_24">
				<view>
					图片
				</view>
				<view class="mt_12 dg jcb gridr_6" style="grid-template-columns: repeat(4, 160rpx);">
					<image class="width_80 height_80 br_4" :src="item" mode="aspectFit" v-for="item,index in imgList"
						:key="index" @click="$utils.handlePreview(index,imgList)"></image>
				</view>
			</view>
			<view class="fx jcb mt_8">
				<text>处理时间</text>
				<text class="fc_999">{{dataInfo.dealTime||''}}</text>
			</view>
			<view class="mt_24">
				<view>
					处理备注
				</view>
				<view class="mt_12 fc_999">
					{{dataInfo.dealRemark||''}}
				</view>
			</view>
			<view class="mt_24">
				<view>
					处理图片
				</view>
				<view class="mt_12 dg jcb gridr_6" style="grid-template-columns: repeat(4, 160rpx);">
					<image class="width_80 height_80 br_4" :src="item" mode="aspectFit" v-for="item,index in dealImgList"
						:key="index" @click="$utils.handlePreview(index,dealImgList)"></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import GoodsCard from '@/components/goods/GoodsCard.vue'
	import api from '@/service/config/api.js'
	const reasonDir = {
		1: '发错商品',
		2: '商品损坏',
		3: '少件',
		4: '其他',
	}
	export default {
		components: {
			GoodsCard
		},
		data() {
			return {
				reasonDir,
				imgList: [],
				dealImgList: [],
				id: '',
				dataInfo: {}
			}
		},
		onLoad(options) {
			this.id = options.id || ''
			this.getData()
		},
		methods: {
			getData() {
				this.$utils.loading()
				api.get('/order/api/orderAfterSale/' + this.id).then(res => {
					this.dataInfo = res.data
					this.imgList = res.data.imageUrl ? res.data.imageUrl.split(',') : []
					this.dealImgList = res.data.dealImageUrl ? res.data.dealImageUrl.split(',') : []
				})
			}
		},
	}
</script>

<style lang="scss">
	.container {}
</style>